package org.apache.ibatis.common.reflection.wrapper;

import org.apache.ibatis.common.reflection.MetaObject;
import org.apache.ibatis.common.reflection.factory.ObjectFactory;
import org.apache.ibatis.common.reflection.property.PropertyTokenizer;

import java.util.Collection;
import java.util.List;

/**
 * @Name CollectionWrapper
 * @Description: Collection 容器（排除 Map）对象包装器 [实现] 类
 * 描述信息：提供 Collection 容器（排除 Map）对象包装器，不过该实现类中没有实现任何扩展功能。
 * @Version v1.0.0
 * @Author: lichao
 * @Date: 2024-04-28 15:04:09
 **/
public class CollectionWrapper implements ObjectWrapper {
    private final Collection<Object> object;

    public CollectionWrapper(Collection<Object> object) {
        this.object = object;
    }

    @Override
    public Object get(PropertyTokenizer prop) {
        throw new UnsupportedOperationException();
    }

    @Override
    public void set(PropertyTokenizer prop, Object value) {
        throw new UnsupportedOperationException();
    }

    @Override
    public String findProperty(String name, boolean useCamelCaseMapping) {
        throw new UnsupportedOperationException();
    }

    @Override
    public String[] getGetterNames() {
        throw new UnsupportedOperationException();
    }

    @Override
    public String[] getSetterNames() {
        throw new UnsupportedOperationException();
    }

    @Override
    public Class<?> getGetterType(String name) {
        throw new UnsupportedOperationException();
    }

    @Override
    public Class<?> getSetterType(String name) {
        throw new UnsupportedOperationException();
    }

    @Override
    public boolean hasSetter(String name) {
        throw new UnsupportedOperationException();
    }

    @Override
    public boolean hasGetter(String name) {
        throw new UnsupportedOperationException();
    }

    @Override
    public MetaObject instantiatePropertyValue(String name, PropertyTokenizer prop, ObjectFactory objectFactory) {
        throw new UnsupportedOperationException();
    }

    @Override
    public boolean isCollection() {
        return true;
    }

    @Override
    public void add(Object element) {
        object.add(element);
    }

    @Override
    public <E> void addAll(List<E> element) {
        object.addAll(element);
    }
}

